<?php

namespace App\Http\Controllers;

use App\Http\Requests\RegisterRequest;
use App\User;
use Illuminate\Http\Request;

class RegisterController extends Controller
{
    //注册页面
    public function index(){
        return view('register.index');
    }

    public function register(RegisterRequest $registerRequest){


        //dd($loginRequest->all());

        $password = bcrypt($registerRequest->input('password'));

        $params = array_merge($registerRequest->only(['name','email']),compact('password'));
//        dd($params);
       $user = User::create($params);

        return redirect("/login");
    }
}
